<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>I18n::Railtie</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            I18n::Railtie 
            
                <span class="parent">&lt; 
                    
                    <a href="../Rails/Railtie.html">Rails::Railtie</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/activesupport/lib/active_support/i18n_railtie_rb.html">activesupport/lib/active_support/i18n_railtie.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Railtie.html#method-c-include_fallbacks_module">include_fallbacks_module</a>,
              </li>
            
              
              <li>
                <a href="Railtie.html#method-c-init_fallbacks">init_fallbacks</a>,
              </li>
            
              
              <li>
                <a href="Railtie.html#method-c-initialize_i18n">initialize_i18n</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>V</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Railtie.html#method-c-validate_fallbacks">validate_fallbacks</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Protected methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-include_fallbacks_module">
            
              <b>include_fallbacks_module</b>()
            
            <a href="Railtie.html#method-c-include_fallbacks_module" name="method-c-include_fallbacks_module" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-include_fallbacks_module_source')" id="l_method-c-include_fallbacks_module_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/d71d5ba71fadf4219c466c0332f78f6e325bcc6c/activesupport/lib/active_support/i18n_railtie.rb#L55" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-include_fallbacks_module_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/i18n_railtie.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">include_fallbacks_module</span>
  <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">backend</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:include</span>, <span class="ruby-constant">I18n</span><span class="ruby-operator">::</span><span class="ruby-constant">Backend</span><span class="ruby-operator">::</span><span class="ruby-constant">Fallbacks</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-init_fallbacks">
            
              <b>init_fallbacks</b>(fallbacks)
            
            <a href="Railtie.html#method-c-init_fallbacks" name="method-c-init_fallbacks" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-init_fallbacks_source')" id="l_method-c-init_fallbacks_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/d71d5ba71fadf4219c466c0332f78f6e325bcc6c/activesupport/lib/active_support/i18n_railtie.rb#L59" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-init_fallbacks_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/i18n_railtie.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">init_fallbacks</span>(<span class="ruby-identifier">fallbacks</span>)
  <span class="ruby-identifier">include_fallbacks_module</span>

  <span class="ruby-identifier">args</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">fallbacks</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">OrderedOptions</span>
    [*(<span class="ruby-identifier">fallbacks</span>[<span class="ruby-value">:defaults</span>] <span class="ruby-operator">||</span> []) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">fallbacks</span>[<span class="ruby-value">:map</span>]].<span class="ruby-identifier">compact</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Hash</span>, <span class="ruby-constant">Array</span>
    <span class="ruby-constant">Array</span>.<span class="ruby-identifier">wrap</span>(<span class="ruby-identifier">fallbacks</span>)
  <span class="ruby-keyword">else</span> <span class="ruby-comment"># TrueClass</span>
    []
  <span class="ruby-keyword">end</span>

  <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">fallbacks</span> = <span class="ruby-constant">I18n</span><span class="ruby-operator">::</span><span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Fallbacks</span>.<span class="ruby-identifier">new</span>(*<span class="ruby-identifier">args</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-initialize_i18n">
            
              <b>initialize_i18n</b>(app)
            
            <a href="Railtie.html#method-c-initialize_i18n" name="method-c-initialize_i18n" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Setup i18n configuration.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-initialize_i18n_source')" id="l_method-c-initialize_i18n_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/d71d5ba71fadf4219c466c0332f78f6e325bcc6c/activesupport/lib/active_support/i18n_railtie.rb#L29" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-initialize_i18n_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/i18n_railtie.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">initialize_i18n</span>(<span class="ruby-identifier">app</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@i18n_inited</span>

  <span class="ruby-identifier">fallbacks</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">i18n</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:fallbacks</span>)

  <span class="ruby-identifier">app</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">i18n</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">setting</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">setting</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:railties_load_path</span>
      <span class="ruby-identifier">app</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">i18n</span>.<span class="ruby-identifier">load_path</span>.<span class="ruby-identifier">unshift</span>(*<span class="ruby-identifier">value</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:load_path</span>
      <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">load_path</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">value</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{setting}=&quot;</span>, <span class="ruby-identifier">value</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">init_fallbacks</span>(<span class="ruby-identifier">fallbacks</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">fallbacks</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">validate_fallbacks</span>(<span class="ruby-identifier">fallbacks</span>)

  <span class="ruby-identifier">reloader</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">FileUpdateChecker</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">I18n</span>.<span class="ruby-identifier">load_path</span>.<span class="ruby-identifier">dup</span>){ <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">reload!</span> }
  <span class="ruby-identifier">app</span>.<span class="ruby-identifier">reloaders</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">reloader</span>
  <span class="ruby-constant">ActionDispatch</span><span class="ruby-operator">::</span><span class="ruby-constant">Reloader</span>.<span class="ruby-identifier">to_prepare</span> { <span class="ruby-identifier">reloader</span>.<span class="ruby-identifier">execute_if_updated</span> }
  <span class="ruby-identifier">reloader</span>.<span class="ruby-identifier">execute</span>

  <span class="ruby-ivar">@i18n_inited</span> = <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-validate_fallbacks">
            
              <b>validate_fallbacks</b>(fallbacks)
            
            <a href="Railtie.html#method-c-validate_fallbacks" name="method-c-validate_fallbacks" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-validate_fallbacks_source')" id="l_method-c-validate_fallbacks_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/d71d5ba71fadf4219c466c0332f78f6e325bcc6c/activesupport/lib/active_support/i18n_railtie.rb#L74" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-validate_fallbacks_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/i18n_railtie.rb, line 74</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">validate_fallbacks</span>(<span class="ruby-identifier">fallbacks</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">fallbacks</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">OrderedOptions</span>
    <span class="ruby-operator">!</span><span class="ruby-identifier">fallbacks</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">TrueClass</span>, <span class="ruby-constant">Array</span>, <span class="ruby-constant">Hash</span>
    <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unexpected fallback type #{fallbacks.inspect}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                        </div>

    </div>
  </body>
</html>    